package com.wld.blacklist;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.PropertySource;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.Transactional;

@PropertySource(value =
    "classpath:system.properties")
@SpringBootApplication(scanBasePackages = {"com.wld.blacklist.*"}, exclude = {
    DataSourceAutoConfiguration.class})
@EnableTransactionManagement
@ServletComponentScan
public class BlackListApplication {

    public static void main(String[] args) {
        SpringApplication.run(BlackListApplication.class, args);
    }

//    /**
//     * http请求转发成https请求
//     */
//    @Bean
//    public TomcatServletWebServerFactory servletContainer() {
//        TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() {
//            @Override
//            protected void postProcessContext(Context context) {
//                SecurityConstraint constraint = new SecurityConstraint();
//                constraint.setUserConstraint("CONFIDENTIAL");
//                SecurityCollection collection = new SecurityCollection();
//                collection.addPattern("/*");
//                constraint.addCollection(collection);
//                context.addConstraint(constraint);
//            }
//        };
//        tomcat.addAdditionalTomcatConnectors(httpConnector());
//        return tomcat;
//    }
//    @Bean
//    public Connector httpConnector() {
//        Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
//        connector.setScheme("http");
//        //默认端口号
//        connector.setPort(8662);
//        connector.setSecure(false);
//        //监听到http的端口号后转向到的https的端口号,项目配置的port
//        connector.setRedirectPort(8662);
//        return connector;
//    }
}
